Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create project #2595

Merged
merged 3 commits into from
Sep 27, 2023
Merged

Create project #2595

merged 3 commits into from
Sep 27, 2023

Conversation

flyingrabbit-lab
Copy link
Collaborator

  • Create project api
  • Refactor http endpoints to get project api key
  • Refactor services to have base class
  • Refactor services to use generic handler

@flyingrabbit-lab flyingrabbit-lab self-assigned this Sep 21, 2023
@flyingrabbit-lab flyingrabbit-lab marked this pull request as draft September 21, 2023 09:50
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 21, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2cf389d
Status: ✅  Deploy successful!
Preview URL: https://23267d32.core-3fo.pages.dev
Branch Preview URL: https://impr-2576-project.core-3fo.pages.dev

View logs

@flyingrabbit-lab flyingrabbit-lab force-pushed the impr/2576-project branch 8 times, most recently from 5bb4525 to 1db03c8 Compare September 21, 2023 17:53
@flyingrabbit-lab flyingrabbit-lab marked this pull request as ready for review September 21, 2023 17:55
@flyingrabbit-lab flyingrabbit-lab force-pushed the impr/2576-project branch 8 times, most recently from 5434fb2 to d096b3b Compare September 25, 2023 10:56
Fixes

Fixes

Fixes

Fixes

Fixes

Fixes

Fixes

Fixes
Fixes

Fixes

Fixes

Fixes

Fixes

Fixes

Fixes

Fixes

Fixes
Copy link
Collaborator

@adamunchained adamunchained left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Where do you require Project ID the get requests?
  • Aren't we missing API Key Controller for the project?

/**
* Project Guardian subcollection.
*/
export interface ProjectGuardian extends BaseSubCollection {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call them Project Admin.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed


batch.create(projectDocRef, project);

const guardianDocRef = projectDocRef.collection(SUB_COL.GUARDIANS).doc(GUARDIAN_ID);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call them project admin's. It's confusing to call them guardians.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

const projectDocRef = build5Db().doc(`${COL.PROJECT}/${projectData.uid}`);
batch.create(projectDocRef, projectData);

const guardianDocRef = projectDocRef.collection(SUB_COL.GUARDIANS).doc(owner);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again let's call them admin please

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

export const voteControl = async (owner: string, params: VoteRequest) => {
const hasStakedSoons = await hasStakedSoonTokens(owner);
export const voteControl = async ({ project, owner }: Context, params: VoteRequest) => {
const hasStakedSoons = await hasStakedTokens(project, owner);
if (!hasStakedSoons) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the "hasStakedSoons" only apply when project billing is ProjectBilling.TOKEN_BASE. How come this was not picked by a test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasStakedSoons returns true if project billing is not TOKEN_BASED

exports[WEN_FUNC.deactivateProject] = deactivateProject;

// TODO Remove this after release
exports['init_soon_project'] = initSoonProject;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope we can eventually have better process for this instead of subsequent commit to update code and release new version

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it is possible, I have moved it to DB rolls

.description(
`Discounts for this project. Set only if billing type is ${ProjectBilling.TOKEN_BASE}`,
),
baseTokenSymbol: Joi.string()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not call it "base..." this confuses the naming convention of whats considered on Shimmer as base token (ie. SMR). You could call it nativeToken if you like.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

@flyingrabbit-lab
Copy link
Collaborator Author

  • Where do you require Project ID the get requests?
  • Aren't we missing API Key Controller for the project?

decodeAuth gets the project id from the project api token.
For now it generates an api upon project creation. I would not implement a controller yet until we discuss what are the specifics for generating api tokens

@adamunchained
Copy link
Collaborator

  • Where do you require Project ID the get requests?
  • Aren't we missing API Key Controller for the project?

decodeAuth gets the project id from the project api token.

For now it generates an api upon project creation. I would not implement a controller yet until we discuss what are the specifics for generating api tokens

make sense, i think my question is also regarding GET Api requests. Ie. getManyById, GetbyId, etc.. when they read data they have to provide api key to get access

@flyingrabbit-lab
Copy link
Collaborator Author

  • Where do you require Project ID the get requests?
  • Aren't we missing API Key Controller for the project?

decodeAuth gets the project id from the project api token.
For now it generates an api upon project creation. I would not implement a controller yet until we discuss what are the specifics for generating api tokens

make sense, i think my question is also regarding GET Api requests. Ie. getManyById, GetbyId, etc.. when they read data they have to provide api key to get access

Yes, I think I wrote this earlier, currently project api key is turned off, not required. Next steps is to update the get requests and do validation in the post requests

@adamunchained adamunchained merged commit 8336161 into develop Sep 27, 2023
69 checks passed
@adamunchained adamunchained deleted the impr/2576-project branch September 27, 2023 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants